import mockjs from 'mockjs';
export default {
  'Get /yr/permission': (req, res) => {
    console.log(req.query, req.body, req.headers.token);
    const { token } = req.headers;
    switch (token) {
      case 'super-admin':
        return res.send({
          code: 200,
          message: 'ok',
          data: {
            admin: ['role-manager'],
          },
        });
      case 'ord-member': // 普通成员
        console.log('ord');
        return res.send({
          code: 200,
          message: 'ok',
          data: {
            admin: ['upload', 'upload-story', 'todo-list', 'echarts'],
          },
        });
      default:
        console.log('ord22', token);
        return res.send({
          code: 401,
          message: 'ok',
        });
    }
  },
  'Post /yr/login': (req, res) => {
    const { account, password } = req.body;
    switch (account) {
      case 'yzl':
        return res.send({
          code: 200,
          message: 'ok',
          data: {
            token: 'ord-member',
          },
        });
      case 'superAdmin':
        return res.send({
          code: 200,
          message: 'ok',
          data: {
            token: 'super-admin',
          },
        });
      default:
        return res.send({
          code: 404,
          message: '没有改账户',
        });
    }
  },
};
